CREATE PROC sp_LOC_DU_LIEU_(@args Arguments READONLY)
AS
BEGIN
	DECLARE @statement AS VARCHAR(1000);
	DECLARE @name AS VARCHAR(50);
	DECLARE @value AS VARCHAR(50);
	
	DECLARE arg CURSOR FOR SELECT * FROM @args;
	OPEN arg;
	FETCH NEXT FROM arg INTO @name, @value;
	SET @statement = 'SELECT * FROM RegisterCourse WHERE ' + @name + '=''' + @value + '''';
	WHILE @@FETCH_STATUS=0
		BEGIN
		FETCH NEXT FROM arg INTO @name, @value;
		IF @@FETCH_STATUS=0 SET @statement = @statement + ' AND ' + @name + '=''' + @value + '''';
		END;
	CLOSE arg;
	DEALLOCATE arg;
	EXEC(@statement);
END;